﻿'Simple Public License (SimPL) 2.0
'The SimPL applies to the software's   source and object code and comes with any rights that I have in it (other than trademarks). You agree to the SimPL by copying, distributing, or making a derivative work of the software.

'You get the royalty free right to:
'   Use the software for any purpose;
'   Make derivative works of it (this is called a 'Derived Work');
'   Copy and distribute it and any Derived Work.

'If you   distribute the software or a Derived Work, you must give back to the community by:
'   Prominently noting the date of any changes you make;
'   Leaving other people's copyright notices, warranty disclaimers, and license terms in place;
'   Providing the source code, build scripts, installation   scripts, and interface definitions in a form that is easy to get and best to modify;

'   Licensing it to everyone under SimPL, or substantially   similar terms (such as GPL 2.0), without adding further restrictions to the rights provided;
'   Conspicuously announcing that it is available under that license.
'
'There are some things that you must shoulder:
'   You get NO WARRANTIES. None of any kind;
'   If the software damages you in any way, you may only recover direct damages   up to the amount you paid for it (that is zero if you did not pay anything). You may not recover any other damages, including those called "consequential damages." (The state or country where you live may not allow you to limit your liability in this way, so this may not apply to you);

'The SimPL continues perpetually, except that   your license rights end automatically if:
'   You do not abide by the "give back to the community" terms (your licensees   get to keep their rights if they abide);
'   Anyone prevents you from   distributing the software under the terms of the SimPL.

Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Content

Namespace Components

  Public Class htmlPost
    Inherits ContentItem

    '''<summary>
    ''' PostTitle: Title of an content item
    '''</summary>
    Public Overloads Property PostTitle() As String
      Get
        Return m_PostTitle
      End Get
      Set(value As String)
        m_PostTitle = value
      End Set
    End Property
    Private m_PostTitle As String

    '''<summary>
    ''' PostDescription: Summary of the text in the content item
    '''</summary>
    Public Property PostDescription() As String
      Get
        Return m_PostDescription
      End Get
      Set(value As String)
        m_PostDescription = value
      End Set
    End Property
    Private m_PostDescription As String

    '''<summary>
    ''' PostPubDate: Last Modified Date of the content item
    '''</summary>
    Public Property PostPubDate() As DateTime
      Get
        Return m_PostPubDate
      End Get
      Set(value As DateTime)
        m_PostPubDate = value
      End Set
    End Property
    Private m_PostPubDate As DateTime

    '''<summary>
    ''' PagePath: path relative to portal root here the page holding the content item is to be found
    '''</summary>
    Public Property PagePath() As String
      Get
        Return m_PagePath
      End Get
      Set(value As String)
        m_PagePath = value
      End Set
    End Property
    Private m_PagePath As String

#Region "IHydratable Implementation"

    ''' <summary>
    ''' 'Call the base classes fill method to populate base class properties
    ''' </summary>
    ''' <param name="dr"></param>
    Public Overrides Sub Fill(dr As System.Data.IDataReader)

      'MyBase.FillInternal(dr)
      Dim str As String
      PostTitle = Null.SetNullString(dr("PostTitle"))
      str = Null.SetNullString(dr("PostDescription"))
      If str.Length > 140 Then
        PostDescription = str.Substring(0, 140) & " ..."
      Else
        PostDescription = str
      End If

      'PageName = Null.SetNullString(dr("PageName"))
      PagePath = "~" & Null.SetNullString(dr("PagePath")) & ".aspx"
      PostPubDate = Null.SetNullDateTime(dr("PostPubDate")).Date

    End Sub


#End Region

  End Class

End Namespace

